<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>

</body>
<script>

  // 编码   (可以编码中文和标点符号)  => 数字和英文字母没有影响
  // encodeURI()               标点符号少
  // encodeURIComponent()      标点符号多

  var str = "今天星期三,投票了没? 123123123asdasdasdasdasd"
  var enStr1 = encodeURI(str);
  console.log(enStr1);

  var enStr2 = encodeURIComponent(str);
  console.log(enStr2);

  // 解码
  // decodeURI()             
  // decodeURIComponent()

  var deStr1 = decodeURI(enStr1);
  console.log(deStr1);

  var deStr2 = decodeURIComponent(enStr2);
  console.log(deStr2);






</script>

</html>